package com.victor.zjbj_android.daichuli.Frament;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.victor.zjbj_android.R;
import com.victor.zjbj_android.daichuli.DaiChuLiYinHuanInfoActivity;
import com.victor.zjbj_android.utils.OnGlobalListener;
import com.victor.zjbj_android.utils.RecyclerViewUtils;
import com.victor.zjbj_android.yinhuan.YinHuanInfoActivity;
import com.victor.zjbj_android.yinhuan.fragment.YihuanListFragment;

import java.util.ArrayList;

/**
 * A simple {@link Fragment} subclass.
 */
public class DaiChuliFragment extends Fragment {
    private RecyclerView rv_list;

    public DaiChuliFragment() {
        // Required empty public constructor
    }

    // TODO: Rename and change types and number of parameters
    public static DaiChuliFragment newInstance(int state) {
        DaiChuliFragment fragment = new DaiChuliFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("state", state);
        fragment.setArguments(bundle);
        return fragment;
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_dai_chuli, container, false);
    }
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        rv_list=view.findViewById(R.id.rv_list);
        ArrayList<String> arrayList=new ArrayList();
        for (int i=0;i<5;i++){
            arrayList.add("1");
        }
        Log.e("1","-");
        Log.e("size",arrayList.size()+"");
        RecyclerViewUtils.initLiner(getActivity(), rv_list, R.layout.item_yinhuan, arrayList, new OnGlobalListener() {
            @Override
            public <T> void logic(BaseViewHolder helper, T item) {

            }
        }, new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                startActivity(new Intent(getActivity(), DaiChuLiYinHuanInfoActivity.class));
            }
        });
        Log.e("2","-");
    }
}
